//
//  RSVerButton.m
//  StaffTax
//
//  Created by 侯伟 on 2020/1/3.
//  Copyright © 2020 侯伟. All rights reserved.
//

#import "RSVerButton.h"

@implementation RSVerButton

- (void)layoutSubviews{
    [super layoutSubviews];
    
    UIImageView* imageView = self.imageView;
    UILabel* titleLb = self.titleLabel;
    if(!imageView || !titleLb)
        return;
    CGFloat marginTop = (self.frame.size.height - imageView.frame.size.height - titleLb.frame.size.height - self.gap)/2;
    CGPoint center = imageView.center;
    center.x = self.frame.size.width/2;
    center.y = imageView.frame.size.height/2 +marginTop;
    imageView.center = center;
    
    CGRect newFrame = titleLb.frame;
    newFrame.origin.x = 0;
    newFrame.origin.y = imageView.frame.size.height + self.gap + marginTop;
    newFrame.size.width = self.frame.size.width;
    titleLb.frame = newFrame;
    titleLb.textAlignment = NSTextAlignmentCenter;
}

@end
